package com.cangxuan.backend.controller;

import com.cangxuan.backend.service.IArticleService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 藏品相关控制器
 */
@Api(tags = "公告相关")
@RestController
@RequestMapping("article")
public class ArticleController extends BaseController {

    IArticleService articleService;
    @Autowired
    public void setArticleService(IArticleService articleService) {
        this.articleService = articleService;
    }
    /**
     * 根据ID获取文章
     * @param typeId
     * @return
     */
    @GetMapping("get/{typeId}")
    @ApiOperation("根据文章类型ID获取文章列表")
    public Object getByTypeID(@ApiParam("文章类型ID") @PathVariable int typeId) {

        return success(articleService.getTypeId(typeId));
    }


    @GetMapping("/content/get/{id}")
    @ApiOperation("根据ID获取文章内容")
    public Object getID(@ApiParam("文章ID") @PathVariable int id) {
        return success(articleService.getID(id));
    }


    @GetMapping("/NewContent/get/{id}")
    @ApiOperation("获取最新文章id")
    public Object getNewID(@ApiParam("文章ID") @PathVariable int id) {
        return success(articleService.getNewID(id));
    }


}
